
import json

from config import LOCAL_PATH


# 读取测试数据 列表+字典 --> 列表+元组
def read_json_data(file_path):
    test_data = []
    with open(file_path, "r", encoding='utf-8') as f:
        json_data = json.load(f)
        for i in json_data:
            test_data.append(tuple(i.values()))
        return test_data

# 断言函数
def assert_common(response, status_code, errno, errmsg):
    # 断言
    # 状态码
    assert response.status_code == status_code
    # errno
    assert response.json().get("errno") == errno
    # errmsg
    assert errmsg in response.json().get("errmsg")

if __name__ == '__main__':
    print(read_json_data(f"{LOCAL_PATH}/data/data_test"))
    print(read_json_data(f"{LOCAL_PATH}/data/register"))